import request from '@/utils/request'

// 查询素材列表
export function listMaterial(query) {
  return request({
    url: '/ips/material/list',
    method: 'get',
    params: query
  })
}

// 查询素材详细
export function getMaterial(id) {
  return request({
    url: '/ips/material/' + id,
    method: 'get'
  })
}

// 上传素材
export function uploadMaterial({data, headers}) {
  return request({
    url: '/ips/material/upload',
    method: 'post',
    headers: headers,
    data: data
  })
}

// 新增素材
export function addMaterial(data) {
  return request({
    url: '/ips/material/save',
    method: 'post',
    data: data
  })
}

// 修改素材
export function editMaterial(data) {
  return request({
    url: '/ips/material/update',
    method: 'put',
    data: data
  })
}

// 分组移至
export function moveTo(ids, groupId, groupName) {
  return request({
    url: '/ips/material/moveTo/' + ids + '/' + groupId + '/' + groupName,
    method: 'put'
  })
}

// 删除素材
export function delMaterial(id) {
  return request({
    url: '/ips/material/remove/' + id,
    method: 'delete'
  })
}

// 导出素材
export function exportMaterial(query, id) {
  return request({
    url: '/ips/material/export/' + id,
    method: 'get',
    params: query
  })
}
